package LeetCode.leetcode;

/**
 * 丑数
 * @author: leiwenkang02@meituan.com
 * @date: 2018/8/27
 * @time: 20:11
 */
public class Test263丑数 {
    public boolean isUgly(int num) {
        if (num < 1) {
            return false;
        }
        while (num % 2 == 0) {
            num = num / 2;
        }
        while (num % 3 == 0) {
            num = num / 3;
        }
        while (num % 5 == 0) {
            num = num / 5;
        }
        return num == 1;
    }
}
